package com.lovemanai.action.user;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 该Action映射到/user/login
 * @author lovemanai
 *
 */
public class LoginAction extends ActionSupport {
	
	private static final long serialVersionUID = 1L;
	
	private String username;
	private String password;
	
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String execute() throws Exception {
		
		ActionContext act = ActionContext.getContext();
		
		if(getUsername().equals("jerry") && getPassword().equals("666")) {
			act.getSession().put("username", getUsername());
			return SUCCESS;
		} else {
			return ERROR;
		}
	}
	
}
